/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * common.h : 
 *
 * Copyright (C) 2008, 2009 Lingtao Pan
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, 
 * Boston, MA 02111-1307, USA.
 */

#ifndef GFTP2_COMMON_H
#define GFTP2_COMMON_H

#include <gftp.h>

#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#include <pthread.h>
#include <assert.h>

#include "bookmark.h"
#include "bmeditor.h"

#include "viewer.h"

#include "interface.h"

#include "callback.h"
#include "util.h"

#include "transfer.h"
#include "transfer-view.h"

extern GftpInterface *gftp_interface;
extern Viewer *left_viewer, *right_viewer;
extern GtkUIManager *ui_manager;
extern pthread_t main_thread_id;
extern gftp_transfer *transfer;

/* log_mutex works with gftp_file_transfer_logs, which is defined
 * in lib/options.h */
extern pthread_mutex_t log_mutex;


#define GFTPUI_COMMON_COLOR_BLACK     "\033[30m"
#define GFTPUI_COMMON_COLOR_RED       "\033[31m"
#define GFTPUI_COMMON_COLOR_GREEN     "\033[32m"
#define GFTPUI_COMMON_COLOR_YELLOW    "\033[33m"
#define GFTPUI_COMMON_COLOR_BLUE      "\033[34m"
#define GFTPUI_COMMON_COLOR_MAGENTA   "\033[35m"
#define GFTPUI_COMMON_COLOR_CYAN      "\033[36m"
#define GFTPUI_COMMON_COLOR_WHITE     "\033[37m"
#define GFTPUI_COMMON_COLOR_GREY      "\033[38m"
#define GFTPUI_COMMON_COLOR_DEFAULT   "\033[39m"
#define GFTPUI_COMMON_COLOR_NONE	""



typedef void * (*thread_func) (void *);



/* gtkui */
void *gftpui_generic_thread (void * (*func) (void *), void *data);

/* misc */
int get_selected_protocol ();
void ftp_log_gui (gftp_logging_level level, gftp_request *requst,
	      const char *string, ... );
void display_cached_logs ();



#define dprintf(args...) fprintf (stderr, args)


#endif
